public class FirstQtnThread extends Thread{

    public FirstQtnThread(String name) {
        super(name);
    }

    @Override
    public void run() {
        for (int i = 0; i <5 ; i++) {
            System.out.println("我是:"+Thread.currentThread().getName()+",i="+i);
            try {
                Thread.sleep(200);
            } catch (InterruptedException e) {
                e.printStackTrace();
            }
        }
    }

    public static void main(String[] args) {
        FirstQtnThread f = new FirstQtnThread("线程A");
        f.start();

        new Thread(()->{
            for (int i = 0; i < 5; i++) {
                System.out.println("我是:"+Thread.currentThread().getName()+",i="+i);
                try {
                    Thread.sleep(200);
                } catch (InterruptedException e) {
                    e.printStackTrace();
                }
            }
        },"线程B").start();

    }
}
